package com.mxx.pmxt.controller;

import com.mxx.pmxt.service.PUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by 马潇霄 on 2017/3/23.
 */

@Controller
public class RegController
{
    @Resource
    PUserService pUserService;

    @RequestMapping("reg")
    public String reg(String uname, String upassword,String urealname, Integer usex, String utel,String uarea,String uaddress){

        pUserService.insertUser(uname,upassword,urealname,usex,utel,uarea+" "+uaddress);
        return "redirect:/showLogin";
    }

    @RequestMapping("/checkUname")
    @ResponseBody
    public int checkUname(String uname)
    {
        return pUserService.checkUName(uname);
    }

}
